<div id="content">
<%= link_to 'New post', :action => 'new' %>
<% for post in @posts.sort{|x,y|
y.create_at <=> x.create_at
} %>
	<div class="post">
	<h2><%=h post.title%></h2>
	<span class="post_date"><%= post.create_at.strftime("%m/%d/%Y") if post.create_at != nil%></span>
	<ul class="post_menu">
	<li><%= link_to 'Show', :action => 'show', :id => post %></li>
    <li><%= link_to 'Edit', :action => 'edit', :id => post %></li>
    <li><%= link_to 'Destroy', { :action => 'destroy', :id => post }, :confirm => 'Are you sure?', :method => :post %></li>
	</ul>
	<div class="post_body">
	<%= post.body%>
	</div>
	<br />
    </div>
<% end %>
</div>

<%= link_to 'Previous page', { :page => @post_pages.current.previous } if @post_pages.current.previous %>
<%= link_to 'Next page', { :page => @post_pages.current.next } if @post_pages.current.next %> 

<br />

